namespace PHMEE.PHM.Algorithms.Diagnosis;

/// <summary>
/// 主滑油泵故障诊断算法
/// </summary>
public class MainLubricatingOilPumpAlg
{
    private readonly MainLubricatingOilPumpService.MainLubricatingOilPumpServiceClient _client;

    public MainLubricatingOilPumpAlg(MainLubricatingOilPumpService.MainLubricatingOilPumpServiceClient client)
    {
        _client = client;
    }
    
    /// <summary>
    /// 主滑油泵故障诊断算法
    /// </summary>
    /// <param name="pointPosition"></param>
    /// <param name="data"></param>
    /// <param name="sampleRate"></param>
    /// <param name="equipmentParameters"></param>
    /// <param name="thresholds"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    public async Task<MainLubricatingOilPumpResponse> MainLubricatingOilPumpAsync(PointPosition pointPosition, float[] data, float sampleRate,
        MainLubricatingOilPumpEquipmentParameters equipmentParameters, MainLubricatingOilPumpThresholds thresholds, int type = 1)
    {
        var request = new MainLubricatingOilPumpRequest
        {
            Position = pointPosition,
            Data = { data },
            SampleRate = sampleRate,
            EquipmentParameters = equipmentParameters,
            Thresholds = thresholds,
            Type = type,
        };
        
        var response = await _client.MainLubricatingOilPumpAlgAsync(request);

        return response;
    }
}